package com.bigpig245.mangareader;

import java.util.ArrayList;
import java.util.List;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;

import com.bigpig245.mangareader.adapter.SimpleArrayAdapter;
import com.bigpig245.mangareader.entity.AbsImageLink;
import com.bigpig245.mangareader.entity.MFChapter;

public class ChapterActivity extends ListActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		List<AbsImageLink> mangaList = new ArrayList<AbsImageLink>();
		mangaList.add(new MFChapter("001", ImageLinkActivity.class));
		mangaList.add(new MFChapter("002", ImageLinkActivity.class));
		mangaList.add(new MFChapter("003", ImageLinkActivity.class));
		mangaList.add(new MFChapter("004", ImageLinkActivity.class));
		mangaList.add(new MFChapter("005", ImageLinkActivity.class));

		SimpleArrayAdapter adapter = new SimpleArrayAdapter(this, mangaList);

		setListAdapter(adapter);
	}


	@Override
	protected void onListItemClick(ListView listView, View view, int position,
			long id) {
		// Launch the sample associated with this list position.
		MFChapter item = (MFChapter) getListAdapter().getItem(position);
		startActivity(new Intent(ChapterActivity.this, item.getActivityClass()));
	}
}
